Portainer Community Edition is a lightweight service delivery platform for containerized applications that can be used to manage Docker, Swarm, Kubernetes and ACI environments. It is designed to be as simple to deploy as it is to use. The application allows you to manage all your orchestrator resources (containers, images, volumes, networks and more) through a ‘smart’ GUI and/or an extensive API. Portainer consists of a single container that can run on any cluster. It can be deployed as a Linux container or a Windows native container. Portainer is a very easy way to get started using containers for development.
Requirements: You must have Docker Engine and Docker Compose installed first. If not installed, go to How To Install Docker On Ubuntu 20.04/22.04.
Install Portainer
1. Create the volume that Portainer Server will use to store its database:
$ docker volume create portainer_data
2. Download and install the Portainer Server container:
$ docker run -d -p 8000:8000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
By default, Portainer generates and uses a self-signed SSL certificate to secure port 9443. Alternatively you can provide your own SSL certificate during installation or via Portainer UI after installation is complete.
If you require HTTP port 9000 open for legacy reasons (or installin via localhost/LAN), add -p 9000:9000
to your docker command:
$ docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
These docker run commands include opening port 8000 which is used for Edge Agent communication. If you do not need this port open, you can remove it from the command. HTTPS is enabled by default on port 9443. These instructions will configure Portainer to use 9443 for HTTPS. If you need to retain HTTP access, you can add: -p 9000:9000
to your command. You can also choose to completely disable HTTP after the update. Before you make Portainer HTTPS only, make sure you have all your Agents and Edge Agents already communicating with Portainer using HTTPS.
To provide your own SSL certs, go to Settings > SSL certificates
and add your certificate and private key files.
3. Check that the Portainer Server container has started
$ docker ps
output:
root@server:~# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
de5b28eb2fa9 portainer/portainer-ce:latest "/portainer" 4 minutes ago Up 3 minutes 0.0.0.0:8000->8000/tcp, :::8000->8000/tcp, 0.0.0.0:9443->9443/tcp, :::9443->9443/tcp portainer
4. Login in Portainer
Go to https://yourdomain.com:9443 or http://localhost:9000 (if local/LAN) where you will be presented with the initial setup page. Enter an admin user name and password.
The installation process automatically detects your local environment and sets it up for you. Click Get Started
to start using Portainer.
Updating Portainer
First, make a backup. Settings > Backup Portainer
. Then do this:
$ docker stop portainer
$ docker rm portainer
$ docker pull portainer/portainer-ce:latest
$ docker run -d -p 8000:8000 -p 9000:9000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:latest
These docker run commands include opening port 8000 which is used for Edge Agent communication. If you do not need this port open, you can remove it from the command. HTTPS is enabled by default on port 9443. These instructions will configure Portainer to use 9443 for HTTPS and do not expose 9000 for HTTP. If you need to retain HTTP access, you can add: -p 9000:9000
to your command. You can also choose to completely disable HTTP after the update. Before you make Portainer HTTPS only, make sure you have all your Agents and Edge Agents already communicating with Portainer using HTTPS.
To provide your own SSL certs, go to Settings > SSL certificates
and add your certificate and private key files.
$ docker run -d -p 8000:8000 -p 9443:9443 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ee:latest --sslcert /path/to/cert/portainer.crt --sslkey /path/to/cert/portainer.key
REFERENCES
https://github.com/portainer/portainer
https://docs.portainer.io/start/install-ce/server/docker/linux
https://docs.portainer.io/start/install-ce/server/setup
https://docs.portainer.io/start/upgrade/docker
https://www.portainer.io/blog/stacks-docker-compose-the-portainer-way
https://docs.portainer.io/start/upgrade/docker
https://github.com/portainer/portainer-compose/blob/master/docker-stack.yml
https://jacar.es/en/como-instalar-portainer-con-docker-compose/
https://docs.portainer.io/advanced/reverse-proxy/traefik
https://github.com/portainer/portainer-compose/tree/master/traefik
https://github.com/portainer/portainer-compose/blob/master/traefik/docker-compose.yml
https://www.apoehlmann.com/blog/setting-up-traefik-with-docker-composer/
https://www.digitalocean.com/community/tutorials/how-to-use-traefik-v2-as-a-reverse-proxy-for-docker-containers-on-ubuntu-20-04